package org.study.spring.properties.controller;

import cn.hutool.core.lang.Dict;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.study.spring.properties.property.ApplicationProperty;
import org.study.spring.properties.property.DeveloperProperty;

/**
 * @author fangyu
 * @version v1.0.0
 * @date 2020/9/29 6:56 下午
 */
@RestController
public class PropertyController {

  private final ApplicationProperty applicationProperty;
  private final DeveloperProperty developerProperty;

  @Autowired
  public PropertyController(
      ApplicationProperty applicationProperty, DeveloperProperty developerProperty) {
    this.applicationProperty = applicationProperty;
    this.developerProperty = developerProperty;
  }

  @GetMapping("/property")
  public Dict index() {
    return Dict.create()
        .set("applicationProperty", applicationProperty)
        .set("developerProperty", developerProperty);
  }
}
